home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 71 / maccd 71.iso / macware / Cyclone 1.2 ƒ / Scripting / Convert one (simple) < prev    next >
Encoding:
Text File  |  1999-11-06  |  984 b   |  40 lines  |  [TEXT/ToyS]

  1. --Before running this script change the "HD:Desktop Folder:sample text" path to point to some text file on your hard drive
  2.  
  3. on run
  4.     ConvertFilesWithCyclone()
  5. end run
  6.  
  7. on ConvertFilesWithCyclone()
  8.     
  9.     set the one_file to "HD:Desktop Folder:sample text"
  10.     tell application "Finder"
  11.         activate
  12.         
  13.         if (exists file one_file) then
  14.             tell application "Cyclone"
  15.                 activate
  16.                 try
  17.                     convert file one_file from Mac_Roman_Euro_Sign to ISO_Latin_1
  18.                 on error
  19.                     error "Error occured during conversion."
  20.                 end try
  21.                 set result_file to result
  22.                 quit
  23.             end tell
  24.             
  25.             if (exists result_file) then
  26.                 set the result_name to (result_file as string)
  27.                 display dialog "Cyclone conversion succeeded!" & return & return & "Output file:" & return & result_name ¬
  28.                     buttons {"OK"} default button 1
  29.             else
  30.                 error "Error occured during conversion."
  31.             end if
  32.             
  33.         else
  34.             error "File \"sample text\" does not exist on Desktop."
  35.         end if
  36.         
  37.     end tell
  38. end ConvertFilesWithCyclone
  39.  
  40.